/**
 * @description  : 请求封装类
 * @descriptionDetail : 请求封装类
 * @copyright    : 浙江烟草
 * @author       : mc
 * @create       : 2022-10-04 16:47:04
 */
import * as req from "@/common/request";
import {getForceHeader,} from "./force.js";
export default {
  /**
   * postForm
   * @param {*} param 
   * @param {*} url 
   */
  postForm:(param,url, headParam = {}) => { 
    headParam = Object.assign(headParam,getForceHeader('form', url, param, uni.getStorageSync("tk") || sessionStorage.getItem('tk') || ""));
    return req.doReq(param, url,'post','application/x-www-form-urlencoded',headParam);
  },
  /**
   * postJson
   * @param {*} param 
   * @param {*} url 
   */
  postJson:(param,url,headParam = {}) => { 
    headParam = Object.assign(headParam,getForceHeader('json', url, param, uni.getStorageSync("tk") || sessionStorage.getItem('tk') || ""));
    return req.doReq(param, url, "post",'application/json; charset=UTF-8',headParam);
  },
  /**
   * get 
   */
  get:(param,url,headParam = {}) => {
    headParam = Object.assign(headParam,getForceHeader('get', url, param, uni.getStorageSync("tk") || sessionStorage.getItem('tk') || ""));
    return req.doReq(param, url, "get",undefined, headParam);
  },
};